package rezetkaTest;


import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import utils.WebDriverFactory;

import java.util.concurrent.TimeUnit;

/**
 * Created by IIGalytska on 10.04.14.
 */
public class PrePostConditions {
    protected static WebDriver driver;

    @Parameters("browser")
    @BeforeSuite(alwaysRun = true)
    public void initEnv(String browser)
    {
        driver = new WebDriverFactory().initDriver(browser);
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        //driver.manage().window().maximize();
    }

    @Parameters("homeUrl")
    @BeforeTest
    public void initPaga(String homeUrl)
    {
        driver.get(homeUrl);
        driver.manage().deleteAllCookies();
    }

    @AfterSuite
    public void clearEnv()
    {
        if (driver!=null)
            driver.quit();
    }

















}
